package com.qm.console.controller.rest;

import com.qm.console.controller.dto.BaseRsp;
import com.qm.console.pubdef.dto.configSetting.ActivityDTO;
import com.qm.console.pubdef.dto.configSetting.AnchorWeightDTO;
import com.qm.console.pubdef.dto.configSetting.PornIdentifyDTO;
import com.qm.console.pubdef.dto.configSetting.WeightDTO;
import com.qm.console.service.configSetting.SettingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/setting")
@Api(value = "[ 控制台:配置设置 ]", description = "设置相关API")
public class SettingController {

    private final SettingService settingService;

    @Autowired
    public SettingController(SettingService settingService){
        this.settingService = settingService;
    }

    @ApiOperation(value = "活动查询", notes = "获取活动")
    @GetMapping("/activity/get")
    public BaseRsp listActivities(){
        return settingService.listActivities();
    }

    @ApiOperation(value = "配置活动", notes = "设置活动配置")
    @PostMapping("/activity/set")
    public BaseRsp updateActivities(@RequestBody ActivityDTO activityDTO){
        return settingService.updateActivities(activityDTO);
    }

    @ApiOperation(value = "鉴黄列表", notes = "鉴黄设置展示")
    @GetMapping("/porn_identify/list")
    public BaseRsp listPornIdentify(){
        return settingService.listPornIdentify();
    }

    @ApiOperation(value = "鉴黄设置", notes = "鉴黄设置修改")
    @PostMapping("/porn_identify/update")
    public BaseRsp updatePornIdentify(@RequestBody PornIdentifyDTO pornIdentifyDTO){
        return settingService.updatePornIdentify(pornIdentifyDTO);
    }

    @ApiOperation(value = "权重列表", notes = "权重设置展示")
    @GetMapping("/weight/list")
    public BaseRsp listWeightSetting(){
        return settingService.listWeightSetting();
    }

    @ApiOperation(value = "权重设置", notes = "权重设置修改")
    @PostMapping("/weight/update")
    public BaseRsp updateWeightSetting(@RequestBody WeightDTO weightDTO){
        return settingService.updateWeightSetting(weightDTO);
    }

    @ApiOperation(value = "主播权重列表", notes = "主播权重设置展示")
    @GetMapping("/anchor_weight/list")
    public BaseRsp listAnchorWeight(){
        return settingService.listAnchorWeight();
    }

    @ApiOperation(value = "主播权重设置", notes = "主播权重设置修改")
    @PostMapping("/anchor_weight/update")
    public BaseRsp updateAnchorWeight(@RequestBody AnchorWeightDTO anchorWeightDTO) {
        return settingService.updateAnchorWeight(anchorWeightDTO);
    }

    @ApiOperation(value = "主播权重删除", notes = "主播权重设置删除")
    @DeleteMapping("/anchor_weight/delete")
    public BaseRsp deleteAnchorWeight(@RequestBody String userId) {
        return settingService.DeleteAnchorWeight(userId);
    }
}
